package com.hs.demo.controller;

import com.alibaba.fastjson.JSONObject;
import com.hs.demo.mapper.TbDetectionRlMapper;
import com.hs.demo.utils.HttpUtils;
import com.hs.demo.vo.TbDetectionRlVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@Slf4j
public class TestController {
    @Autowired
    TbDetectionRlMapper detectionRlMapper;

    @RequestMapping("/push")
    public Object push(Long id){
        log.info("推送质检数据开始id:" + id);
        TbDetectionRlVO tbDetectionRl = detectionRlMapper.selectTbDetectionRlByIdCondition(id);
        System.out.println("http推送数据为：" + JSONObject.toJSON(tbDetectionRl));
        HttpUtils.sendPostJson("http://221.214.27.228:6271/",JSONObject.toJSON(tbDetectionRl).toString());
        return JSONObject.toJSON(tbDetectionRl);
    }
}
